From version 10.1.0,
ReplayBuffer (and its sub-classes) supports save and load transitions (not entire buffer).
Since this functionality is based on Python pickle serialization, you MUST NOT load untrusted file, otherwise you might introduce security vulnerability.
The API are
save_transitions(self, file, *, safe=True) and
load_transitions(self, file). The
file parameter is
str. Internally, cpprb utilizes numpy.savez_compressed, so that the file name have to end with
".npz". (If not, automatically the suffix is added.)
safe=True (default), stored transitions are once dumped with
get_all_transitions(), then the well-organized transitions are saved. This is much safer configuration in terms of future compatibility. We highly recommend this whenever you can.
safe=False and at least one of
stack_compress are enabled, cpprb tries to reduce file size by dumping internal compressed data structure directly. (If none of the options are enabled, it fallbacks to
safe=True.) This also saves some internal meta-data for reconstruction of transitions, so that it is possible that file size can be larger than
safe=True for small data.
You have to initialize
ReplayBuffer with compatible configuration before load transitions, otherwise you will get errors (
KeyError, etc.) or unintentional silent bug.
load_transitions does not overwrite existent transitions but adds, so that if you want to delete, please call